class Solution(object):
    def addStrings(self, num1, num2):
        """
        :type num1: str
        :type num2: str
        :rtype: str
        """
        num1 = num1[::-1]
        num2 = num2[::-1]
        n1 = len(num1)
        n2 = len(num2)
        add = 0
        i = 0
        s = ''
        while i < n1 and i < n2:
            num = int(num1[i]) + int(num2[i]) + add
            add = num // 10
            s += str(num % 10)
            i += 1
        while i < n1:
            num = int(num1[i]) + add
            add = num // 10
            s += str(num % 10)
            i += 1
        while i < n2:
            num = int(num2[i]) + add
            add = num // 10
            s += str(num % 10)
            i += 1
        if add == 1:
            s += str(1)
        return s[::-1]


data = Solution()
num1 = "11"
num2 = "123"
print(data.addStrings(num1, num2))
